package com.xuxin.pda.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.xuxin.pda.R;
import com.xuxin.pda.bean.MainBean;
import com.xuxin.pda.glide.GlideApp;

import org.jetbrains.annotations.NotNull;

/**
 * Created by xu_xin
 * Created on 2020.08.07 0007
 */
public class MainAdapter extends BaseQuickAdapter<MainBean, BaseViewHolder> {

    public MainAdapter() {
        super(R.layout.item_main);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, MainBean item) {
        holder.setText(R.id.item_main_name, item.getName());
        /**
         * 加载图片
         */
        ImageView item_main_image = holder.findView(R.id.item_main_image);
        if (null != item_main_image) {
            GlideApp.with(getContext()).load(item.getId()).centerCrop().into(item_main_image);
        }
    }
}